# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/10/13
# @File : 25.E - Queen on Grid.py
"""
思路对了，方法对了，优化对了，为什么超时呢？因为我的初始化是分离先预处理好的，但是初始化的这一行没有记得取模。以为第一行的结果不会那么大吧。还可以优化一下空间。
"""
modulo = 10 ** 9 + 7
h,w = map(int,input().split())
grid = [ input() for _ in range(h)]
dp = [[0]*(w) for _ in range(h)]
rr = [[0]*(w) for _ in range(h)]#分三个方向的累加和数组。这个也完完全全想到了。
dd = [[0]*(w) for _ in range(h)]
rd = [[0]*(w) for _ in range(h)]
dp[0][0] = 1
rr[0][0] = 1
dd[0][0] = 1
rd[0][0] = 1
for i in range(1,w):
    if(grid[0][i]=="."):
        dp[0][i] = rr[0][i-1]
        rr[0][i] = (rr[0][i-1] + dp[0][i])%modulo
        dd[0][i] = dp[0][i]%modulo
        rd[0][i] = dp[0][i]%modulo
for i in range(1,h):
    if (grid[i][0] == "."):
        dp[i][0] = dd[i-1][0]
        rr[i][0] = dp[i][0]%modulo
        dd[i][0] = (dd[i-1][0] + dp[i][0])%modulo
        rd[i][0] = dp[i][0]%modulo
for i in range(1,h):
    for j in range(1,w):
        if(grid[i][j]=="."):
            dp[i][j] = (rr[i][j-1] + dd[i-1][j] + rd[i-1][j-1])%modulo#每次三个方向相加。
            rr[i][j] = (rr[i][j-1] + dp[i][j])%modulo
            dd[i][j] = (dd[i-1][j] + dp[i][j])%modulo
            rd[i][j] = (rd[i-1][j-1] + dp[i][j])%modulo
print(dp[h-1][w-1])






